Msql 5.7 安装

Msql 5.7 安装

添加 Mysql 5.7 仓库

1
rpm -ivh https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

确认Mysql仓库添加成功

1
yum repolist all | grep mysql | grep enabled

安装Mysql 5.7

1
yum -y install mysql-community-server

启动Mysql

1
2
systemctl start mysqld
systemctl enable mysqld

安全设置

1
2
cat /var/log/mysqld.log | grep -i 'temporary password'
mysql_secure_installation

设置数据库编码

1
2
3
4
5
6
7
8
9
10
11
12
vim /etc/my.cnf

[client]
default-character-set=utf8

[mysql]
default-character-set=utf8

[mysqld]
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8

重启mysql

1
systemctl restart mysqld